/**
 * <copyright>
 *
 * Copyright (c) 2002-2006 IBM Corporation and others.
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors: 
 *   IBM - Initial API and implementation
 *
 * </copyright>
 *
 * $Id: NotificationWrapper.java,v 1.4 2006/12/05 20:19:54 emerks Exp $
 */
package org.oppoweb.emf.common.notify {

/**
 * A notification that wraps another notification.
 * All the {@link Notification} methods are delegated to the wrapped notification.
 */
public class NotificationWrapper implements Notification
{
  /**
   * The notification that is being wrapped.
   */
  protected var notification:Notification;

  /**
   * An optional override value for the notification's notifier.
   */
  protected var notifier:Object;

  /**
   * Create an instance with the specified notifier and notification.
   */
  public function NotificationWrapper(notification:Notification, notifier:Object = null)
  {
    this.notifier = notifier;
    this.notification = notification;
  }
  
  /**
   * Returns the local notifier if set; otherwise delegates to the getNotifier method of the notification.
   * @return the notifier.
   */
  public function getNotifier():Object
  {
    return notifier == null ? notification.getNotifier() : notifier;
  }

  /**
   * Delegates to the getEventType method of the notification.
   * @return the eventType.
   */
  public function getEventType():int
  {
    return notification.getEventType();
  }

  /**
   * Delegates to the getFeatureID method of the notification.
   * @return the featureID.
   */
  public function getFeatureID(expectedClass:Class):int
  {
    return notification.getFeatureID(expectedClass);
  }

  /**
   * Delegates to the getFeature method of the notification.
   * @return the feature.
   */
  public function getFeature():Object
  {
    return notification.getFeature();
  }

  /**
   * Delegates to the getOldValue method of the notification.
   * @return the oldValue.
   */
  public function getOldValue():Object
  {
    return notification.getOldValue();
  }

  /**
   * Delegates to the getNewValue method of the notification.
   * @return the newValue.
   */
  public function getNewValue():Object
  {
    return notification.getNewValue();
  }

  /**
   * Delegates to the wasSet method of the notification.
   * @return the wasSet result.
   */
  public function wasSet():Boolean
  {
    return notification.wasSet();
  }

  /**
   * Delegates to the isTouch method of the notification.
   * @return the isTouch result.
   */
  public function isTouch():Boolean
  {
    return notification.isTouch();
  }

  /**
   * Delegates to the isReset method of the notification.
   * @return the isReset result.
   */
  public function isReset():Boolean
  {
    return notification.isReset();
  }

  /**
   * Delegates to the getPosition method of the notification.
   * @return the position.
   */
  public function getPosition():int
  {
    return notification.getPosition();
  }

  /**
   * Delegates to the merge method of the notification.
   * @return the merge result.
   */
  public merge(notification:Notification):Boolean
  {
    return false;
  }
 
}
}